<?php
/*
 * Created on 2012-5-1
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 ob_start();
  include("../../nncms_manager_inc.php");
//加载多语言
include_once($nncms_config_path.'nn_cms_manager/nncms_mlang.php');
$view_delete=$_GET["view_delete"];
$nns_live_search=$_GET["nns_live_search"];
$view_audit=$_GET["view_audit"];
$depot_id=$_GET["depot_id"];
$depot_detail_id=$_GET["depot_detail_id"];
$view_type_delete=$_GET["view_delete_type"];


//高级查询
$search_yy=$_GET["search_yy"];
$search_dy=$_GET["search_dy"];
$search_point=$_GET["search_point"];
$search_sy_begin_date=$_GET["search_sy_begin_date"];
$search_sy_end_date=$_GET["search_sy_end_date"];
$search_rk_begin_date=$_GET["search_rk_begin_date"];
$search_rk_end_date=$_GET["search_rk_end_date"];
$search_copyright_begin_date=$_GET["search_copyright_begin_date"];
$search_copyright_end_date=$_GET["search_copyright_end_date"];
 
 include ($nncms_config_path. "nn_cms_config/nn_cms_global.php");
// echo $nncms_db_path. "nns_role/nns_db_role_class.php";
 include($nncms_db_path. "nns_live/nns_db_live_class.php");
 include $nncms_db_path. "nns_common/nns_db_constant.php";
 
 $live_inst=new nns_db_live_class();
 $live_array=$live_inst->nns_db_live_list("nns_id,nns_name,nns_director,nns_actor,nns_show_time,nns_view_len,nns_all_index,nns_area,nns_image0,nns_image1,nns_image2,nns_summary,nns_copyright_date,nns_point",
	$nns_live_search,"",$view_audit,$view_type,$depot_id,$depot_detail_id,"","","",$searchinfo,"",0,0,$view_delete,null,null,null,$search_sy_begin_date,$search_sy_end_date,$search_rk_begin_date,$search_rk_end_date,$search_copyright_begin_date,$search_copyright_end_date,$search_point);
	
 $live_inst=null;
// var_dump($manager_array);
 if ($live_array["ret"]!=0){
	$data=null;
	echo "<script>alert(". $vod_array["reason"].");</script>";
 }else{
	$data=$live_array["data"];
	require_once "../../controls/nncms_controls_csv_export.php";
	$csv_inst=new nncms_controls_csv_export();
	$csv_content=$csv_inst->create_csv_content($data);
	$csv_inst=null;
	$now_time_str=date("YmdHis");
	 require_once $nncms_db_path. "nns_log".DIRECTORY_SEPARATOR . "nns_db_op_log_class.php";
	$log_inst=new nns_db_op_log_class();
	$log_inst->nns_db_op_log_add($_SESSION["nns_mgr_id"],"export",$_SESSION["nns_mgr_name"].cms_get_lang('export_csv').":".cms_get_lang('lmgl_zblm').$depot_detail_id,$_SESSION["nns_manager_type"],$_SESSION["nns_org_id"]);
	$log_inst=null;
	ob_end_clean();
// 	header( "content-length: ". strlen( $csv_content ) );
//	header( "content-type: text/csv" ) ;
//	header( "cache-control: public" );
	header('Content-Type:text/csv');
	header ("Content-Disposition: attachment; filename*=GBK''". $depot_detail_id  ."_1_".$now_time_str. ".csv" );
//	echo "\xef\xbb\xbf".$csv_content;
	echo iconv('UTF-8','GBK',$csv_content);
 }
?>